<?php


namespace App\Controller\Api;

use _HumbugBox373c0874430e\Nette\Neon\Exception;
use App\Constants\ErrorForPayApi;
use App\Middleware\Api\PayApiAuthMiddleware;

// use App\Middleware\MchApi\MchJWTAuthMiddleware;
use App\Middleware\Api\PayServerSignMiddleware;
use App\Middleware\Api\PayWebSignMiddleware;
use App\Middleware\TranslatorMiddleware;
use App\Model\Enum\PayTypeEnum;
use App\Model\Enum\StatusEnum;
use App\Service\MchPayService;
use App\Service\PayApi\Callback\PayCallbackService;
use App\Service\SysCardTypeInfoService;
use App\Utils\CreditCardUtils;
use App\Utils\CustomUtils;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\Middleware;
use Hyperf\HttpServer\Annotation\Middlewares;
use Hyperf\HttpServer\Annotation\PostMapping;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Contract\ResponseInterface;
use Hyperf\Utils\Arr;

/**
 * Class PayCallbackController
 * 网关支付回调 
 *
 * @package App\Controller\Api
 * @Controller(prefix="/api/pay/callback")
 * @Middleware(TranslatorMiddleware::class)
 */
class PayCallbackController extends BaseController {

    /**
     * @var PayCallbackService
     * @Inject()
     */
    protected $PayCallbackService;

    /**
     * 测试回调
     * @PostMapping(path="test")
     *
     * @param RequestInterface $request
     *
     * @return array
     * @throws \Exception
     */
    public function test (RequestInterface $request) {

        $param = [
            'relNo' => $request->post('relNo'),
        ];

        return $this->PayCallbackService->handle($param);
    }
}
